package com.esreport.dao;

import com.esreport.entity.Report;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Component;


@Component
public interface ReportRepository extends ElasticsearchRepository<Report,String>{

    /**
     * 按时间统计点击量
     * @param from
     * @param to
     * @return
     */
    long countByStartTimeBetweenAndSiteId(long from ,long to,Integer siteId);

    /**
     * 按时间和行为
     * @param from
     * @param to
     * @param action
     * @return
     */
    long countByStartTimeBetweenAndActionAndSiteId(long from,long to,String action,Integer siteId);

    /**
     * 按时间，行为，页面
     * @param from 开始时间
     * @param to 结束时间
     * @param action 行为
     * @param nowScene 页面类型
     * @param siteId 站点
     * @return
     */
    long countByStartTimeBetweenAndActionAndNowSceneAndSiteId(long from,long to,String action,String nowScene,Integer siteId);


    /**
     * 总访问量 只按站点查
     * @param siteId
     * @return
     */
    long countBySiteId(Integer siteId);

}
